using System;
using System.Drawing;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using Snarl;

namespace NativeWindowApplication
{

    // Summary description for PawingSnarlMsgWnd.
    [System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand, Name = "FullTrust")]


    public class PawingSnarlMsgWnd : NativeWindow
    {
        CreateParams cp = new CreateParams();

        int SNARL_GLOBAL_MESSAGE;

        public PawingSnarlMsgWnd()
        {
            // Create the actual window
            this.CreateHandle(cp);
            this.SNARL_GLOBAL_MESSAGE = Snarl.SnarlConnector.GetGlobalMsg();
        }

        protected override void WndProc(ref Message m)
        {

            if (m.Msg == this.SNARL_GLOBAL_MESSAGE)
            {
                if ((int)m.WParam == Snarl.SnarlConnector.SNARL_LAUNCHED)
                {
                    // Snarl has been (re)started during Shaim already running
                    // so let's register (again)
                    Snarl.SnarlConnector.GetSnarlWindow(true);

                    SnarlConnector.RegisterConfig(this.Handle, "Pawing", Snarl.WindowsMessage.WM_USER + 55);

                    SnarlConnector.RegisterAlert("Pawing", "New tweet");
                    SnarlConnector.RegisterAlert("Pawing", "New tweets summarized");
                    SnarlConnector.RegisterAlert("Pawing", "New reply");
                    SnarlConnector.RegisterAlert("Pawing", "New direct message");
                    SnarlConnector.RegisterAlert("Pawing", "New mention");

                }
            }
            base.WndProc(ref m);

        }

    }

}
